﻿#pragma once

#include "Packet.h"
#include "Data/SharedData.h"
#include "Enums.h"
#include "Data/GuildData.h"
#include "Data/ItemData.h"
#include "Data/ClientData.h"
#include "Data/IntelligentCreatureData.h"
#include "BaseStats.h"
#include "Data/Stat.h"
#include "Data/Notice.h"
#include <string>
#include <vector>

private:
﻿using *System;

namespace ServerPackets
{
    class KeepAlive final : public Packet
    {
    public:
        short getIndex() const override;
        long long Time = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class Connected final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ClientVersion final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char Result = 0;
        /*
         * 0: Wrong Version
         * 1: Correct Version
         */

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class Disconnect final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char Reason = 0;

        /*
         * 0: Server Closing.
         * 1: Another User.
         * 2: Packet Error.
         * 3: Server Crashed.
         */

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class NewAccount final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char Result = 0;
        /*
         * 0: Disabled
         * 1: Bad AccountID
         * 2: Bad Password
         * 3: Bad Email
         * 4: Bad Name
         * 5: Bad Question
         * 6: Bad Answer
         * 7: Account Exists.
         * 8: Success
         */

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;

    };
    class ChangePassword final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char Result = 0;
        /*
         * 0: Disabled
         * 1: Bad AccountID
         * 2: Bad Current Password
         * 3: Bad New Password
         * 4: Account Not Exist
         * 5: Wrong Password
         * 6: Success
         */

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ChangePasswordBanned final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Reason = std::string::Empty;
        DateTime ExpiryDate;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class Login final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char Result = 0;
        /*
         * 0: Disabled
         * 1: Bad AccountID
         * 2: Bad Password
         * 3: Account Not Exist
         * 4: Wrong Password
         */

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class LoginBanned final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Reason = std::string::Empty;
        DateTime ExpiryDate;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class LoginSuccess final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<SelectInfo*> Characters = std::vector<SelectInfo*>();

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class NewCharacter final : public Packet
    {
    public:
        short getIndex() const override;

        /*
         * 0: Disabled.
         * 1: Bad Character Name
         * 2: Bad Gender
         * 3: Bad Class
         * 4: Max Characters
         * 5: Character Exists.
         * */
        unsigned char Result = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class NewCharacterSuccess final : public Packet
    {
    public:
        virtual ~NewCharacterSuccess()
        {
            delete CharInfo;
        }

        short getIndex() const override;

        SelectInfo *CharInfo;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class DeleteCharacter final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char Result = 0;

        /*
         * 0: Disabled.
         * 1: Character Not Found
         * */

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class DeleteCharacterSuccess final : public Packet
    {
    public:
        short getIndex() const override;

        int CharacterIndex = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class StartGame final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char Result = 0;
        int Resolution = 0;

        /*
         * 0: Disabled.
         * 1: Not logged in
         * 2: Character not found.
         * 3: Start Game Error
         * */

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class StartGameBanned final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Reason = std::string::Empty;
        DateTime ExpiryDate;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class StartGameDelay final : public Packet
    {
    public:
        short getIndex() const override;

        long long Milliseconds = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;

    };
    class MapInformation final : public Packet
    {
    public:
        short getIndex() const override;

        std::string FileName = std::string::Empty;
        std::string Title = std::string::Empty;
        unsigned short MiniMap = 0, BigMap = 0, Music = 0;
        LightSetting Lights = static_cast<LightSetting>(0);
        bool Lightning = false, Fire = false;
        unsigned char MapDarkLight = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class UserInformation final : public Packet
    {
    public:
        virtual ~UserInformation()
        {
            delete NameColour;
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        unsigned int RealId = 0;
        std::string Name = std::string::Empty;
        std::string GuildName = std::string::Empty;
        std::string GuildRank = std::string::Empty;
        Color *NameColour;
        MirClass Class = static_cast<MirClass>(0);
        MirGender Gender = static_cast<MirGender>(0);
        unsigned short Level = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        unsigned char Hair = 0;
        int HP = 0, MP = 0;
        long long Experience = 0, MaxExperience = 0;

        LevelEffects LevelEffects = static_cast<LevelEffects>(0);

        std::vector<UserItem*> Inventory, Equipment, QuestInventory;
        unsigned int Gold = 0, Credit = 0;

        bool HasExpandedStorage = false;
        DateTime ExpandedStorageExpiryTime;

        std::vector<ClientMagic*> Magics;

        std::vector<ClientIntelligentCreature*> IntelligentCreatures; //IntelligentCreature
        IntelligentCreatureType SummonedCreatureType = IntelligentCreatureType::None; //IntelligentCreature
        bool CreatureSummoned = false; //IntelligentCreature



    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class UserSlotsRefresh final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<UserItem*> Inventory, Equipment;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class UserLocation final : public Packet
    {
    public:
        virtual ~UserLocation()
        {
            delete Location;
        }

        short getIndex() const override;

        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectPlayer final : public Packet
    {

    public:
        virtual ~ObjectPlayer()
        {
            delete NameColour;
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        std::string Name = std::string::Empty;
        std::string GuildName = std::string::Empty;
        std::string GuildRankName = std::string::Empty;
        Color *NameColour;
        MirClass Class = static_cast<MirClass>(0);
        MirGender Gender = static_cast<MirGender>(0);
        unsigned short Level = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        unsigned char Hair = 0;
        unsigned char Light = 0;
        short Weapon = 0, WeaponEffect = 0, Armour = 0;
        PoisonType Poison = static_cast<PoisonType>(0);
        bool Dead = false, Hidden = false;
        SpellEffect Effect = static_cast<SpellEffect>(0);
        unsigned char WingEffect = 0;
        bool Extra = false;

        short MountType = 0;
        bool RidingMount = false;
        bool Fishing = false;

        short TransformType = 0;

        unsigned int ElementOrbEffect = 0;
        unsigned int ElementOrbLvl = 0;
        unsigned int ElementOrbMax = 0;

        LevelEffects LevelEffects = static_cast<LevelEffects>(0);

        std::vector<BuffType> Buffs;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectRemove final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;

    };
    class ObjectTurn final : public Packet
    {
    public:
        virtual ~ObjectTurn()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectWalk final : public Packet
    {
    public:
        virtual ~ObjectWalk()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectRun final : public Packet
    {
    public:
        virtual ~ObjectRun()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class Chat final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Message = std::string::Empty;
        ChatType Type = static_cast<ChatType>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectChat final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        std::string Text = std::string::Empty;
        ChatType Type = static_cast<ChatType>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class NewItemInfo final : public Packet
    {
    public:
        virtual ~NewItemInfo()
        {
            delete Info;
        }

        short getIndex() const override;

        ItemInfo *Info;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class NewChatItem final : public Packet
    {
    public:
        virtual ~NewChatItem()
        {
            delete Item;
        }

        short getIndex() const override;

        UserItem *Item;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class MoveItem final : public Packet
    {
    public:
        short getIndex() const override;

        MirGridType Grid = static_cast<MirGridType>(0);
        int From = 0, To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class EquipItem final : public Packet
    {
    public:
        short getIndex() const override;

        MirGridType Grid = static_cast<MirGridType>(0);
        unsigned long long UniqueID = 0;
        int To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class MergeItem final : public Packet
    {
    public:
        short getIndex() const override;

        MirGridType GridFrom = static_cast<MirGridType>(0), GridTo = static_cast<MirGridType>(0);
        unsigned long long IDFrom = 0, IDTo = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class RemoveItem final : public Packet
    {
    public:
        short getIndex() const override;

        MirGridType Grid = static_cast<MirGridType>(0);
        unsigned long long UniqueID = 0;
        int To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class RemoveSlotItem final : public Packet
    {
    public:
        short getIndex() const override;

        MirGridType Grid = static_cast<MirGridType>(0);
        MirGridType GridTo = static_cast<MirGridType>(0);
        unsigned long long UniqueID = 0;
        int To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class TakeBackItem final : public Packet
    {
    public:
        short getIndex() const override;

        int From = 0, To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class StoreItem final : public Packet
    {
    public:
        short getIndex() const override;

        int From = 0, To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class DepositRefineItem final : public Packet
    {
    public:
        short getIndex() const override;

        int From = 0, To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class RetrieveRefineItem final : public Packet
    {
    public:
        short getIndex() const override;

        int From = 0, To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class RefineCancel final : public Packet
    {
    public:
        short getIndex() const override;

        bool Unlock = false;
    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class RefineItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class DepositTradeItem final : public Packet
    {
    public:
        short getIndex() const override;

        int From = 0, To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class RetrieveTradeItem final : public Packet
    {
    public:
        short getIndex() const override;

        int From = 0, To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class SplitItem final : public Packet
    {
    public:
        virtual ~SplitItem()
        {
            delete Item;
        }

        short getIndex() const override;

        UserItem *Item;
        MirGridType Grid = static_cast<MirGridType>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class SplitItem1 final : public Packet
    {
    public:
        short getIndex() const override;

        MirGridType Grid = static_cast<MirGridType>(0);
        unsigned long long UniqueID = 0;
        unsigned short Count = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class UseItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class DropItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        unsigned short Count = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class PlayerUpdate final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        unsigned char Light = 0;
        short Weapon = 0, WeaponEffect = 0, Armour = 0;
        unsigned char WingEffect = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class PlayerInspect final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name = std::string::Empty;
        std::string GuildName = std::string::Empty;
        std::string GuildRank = std::string::Empty;
        std::vector<UserItem*> Equipment;
        MirClass Class = static_cast<MirClass>(0);
        MirGender Gender = static_cast<MirGender>(0);
        unsigned char Hair = 0;
        unsigned short Level = 0;
        std::string LoverName;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class MarriageRequest final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class DivorceRequest final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class MentorRequest final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name;
        unsigned short Level = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class TradeRequest final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class TradeAccept final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class TradeGold final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int Amount = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class TradeItem final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<UserItem*> TradeItems;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class TradeConfirm final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class TradeCancel final : public Packet
    {
    public:
        short getIndex() const override;

        bool Unlock = false;
    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class LogOutSuccess final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<SelectInfo*> Characters = std::vector<SelectInfo*>();

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class LogOutFailed final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class TimeOfDay final : public Packet
    {
    public:
        short getIndex() const override;

        LightSetting Lights = static_cast<LightSetting>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ChangeAMode final : public Packet
    {
    public:
        short getIndex() const override;

        AttackMode Mode = static_cast<AttackMode>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ChangePMode final : public Packet
    {
    public:
        short getIndex() const override;

        PetMode Mode = static_cast<PetMode>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectItem final : public Packet
    {
    public:
        virtual ~ObjectItem()
        {
            delete NameColour;
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        std::string Name = std::string::Empty;
        Color *NameColour;
        Point *Location;
        unsigned short Image = 0;
        ItemGrade grade = static_cast<ItemGrade>(0);


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectGold final : public Packet
    {
    public:
        virtual ~ObjectGold()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        unsigned int Gold = 0;
        Point *Location;


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class GainedItem final : public Packet
    {
    public:
        virtual ~GainedItem()
        {
            delete Item;
        }

        short getIndex() const override;

        UserItem *Item;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class GainedGold final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int Gold = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class LoseGold final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int Gold = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class GainedCredit final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int Credit = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class LoseCredit final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int Credit = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ObjectMonster final : public Packet
    {
    public:
        virtual ~ObjectMonster()
        {
            delete NameColour;
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        std::string Name = std::string::Empty;
        Color *NameColour;
        Point *Location;
        Monster Image = static_cast<Monster>(0);
        MirDirection Direction = static_cast<MirDirection>(0);
        unsigned char Effect = 0, AI = 0, Light = 0;
        bool Dead = false, Skeleton = false;
        PoisonType Poison = static_cast<PoisonType>(0);
        bool Hidden = false, Extra = false;
        unsigned char ExtraByte = 0;
        long long ShockTime = 0;
        bool BindingShotCenter = false;

        std::vector<BuffType> Buffs;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;

    };
    class ObjectAttack final : public Packet
    {
    public:
        virtual ~ObjectAttack()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        Spell Spell = static_cast<Spell>(0);
        unsigned char Level = 0;
        unsigned char Type = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class Struck final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int AttackerID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectStruck final : public Packet
    {
    public:
        virtual ~ObjectStruck()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        unsigned int AttackerID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class DamageIndicator final : public Packet
    {
    public:
        int Damage = 0;
        DamageType Type = static_cast<DamageType>(0);
        unsigned int ObjectID = 0;

        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class DuraChanged final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        unsigned short CurrentDura = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class HealthChanged final : public Packet
    {
    public:
        short getIndex() const override;

        int HP = 0, MP = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class DeleteItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        unsigned short Count = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class Death final : public Packet
    {
    public:
        virtual ~Death()
        {
            delete Location;
        }

        short getIndex() const override;

        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectDied final : public Packet
    {
    public:
        virtual ~ObjectDied()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        unsigned char Type = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ColourChanged final : public Packet
    {
    public:
        virtual ~ColourChanged()
        {
            delete NameColour;
        }

        short getIndex() const override;

        Color *NameColour;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectColourChanged final : public Packet
    {
    public:
        virtual ~ObjectColourChanged()
        {
            delete NameColour;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Color *NameColour;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectGuildNameChanged final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        std::string GuildName;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class GainExperience final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int Amount = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class LevelChanged final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned short Level = 0;
        long long Experience = 0, MaxExperience = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectLeveled final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectHarvest final : public Packet
    {
    public:
        virtual ~ObjectHarvest()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectHarvested final : public Packet
    {
    public:
        virtual ~ObjectHarvested()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;

    };
    class ObjectNPC final : public Packet
    {
    public:
        virtual ~ObjectNPC()
        {
            delete NameColour;
            delete Colour;
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        std::string Name = std::string::Empty;

        Color *NameColour;
        unsigned short Image = 0;
        Color *Colour;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        std::vector<int> QuestIDs;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCResponse final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<std::string> Page;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectHide final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectShow final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class Poisoned final : public Packet
    {
    public:
        short getIndex() const override;

        PoisonType Poison = static_cast<PoisonType>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectPoisoned final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        PoisonType Poison = static_cast<PoisonType>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class MapChanged final : public Packet
    {
    public:
        virtual ~MapChanged()
        {
            delete Location;
        }

        short getIndex() const override;

        std::string FileName = std::string::Empty;
        std::string Title = std::string::Empty;
        unsigned short MiniMap = 0, BigMap = 0, Music = 0;
        LightSetting Lights = static_cast<LightSetting>(0);
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        unsigned char MapDarkLight = 0;


    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectTeleportOut final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        unsigned char Type = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectTeleportIn final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        unsigned char Type = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class TeleportIn final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCGoods final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<UserItem*> List = std::vector<UserItem*>();
        float Rate = 0;
        PanelType Type = static_cast<PanelType>(0);
        bool HideAddedStats = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCSell final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCRepair final : public Packet
    {
    public:
        short getIndex() const override;
        float Rate = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCSRepair final : public Packet
    {
    public:
        short getIndex() const override;

        float Rate = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class NPCRefine final : public Packet
    {
    public:
        short getIndex() const override;

        float Rate = 0;
        bool Refining = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class NPCCheckRefine final : public Packet
    {
    public:
        short getIndex() const override;


    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class NPCCollectRefine final : public Packet
    {
    public:
        short getIndex() const override;

        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class NPCReplaceWedRing final : public Packet
    {
    public:
        short getIndex() const override;

        float Rate = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class NPCStorage final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class SellItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        unsigned short Count = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class RepairItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ItemRepaired final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        unsigned short MaxDura = 0, CurrentDura = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ItemSlotSizeChanged final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        int SlotSize = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };


    class NewMagic final : public Packet
    {
    public:
        virtual ~NewMagic()
        {
            delete Magic;
        }

        short getIndex() const override;

        ClientMagic *Magic;
    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class RemoveMagic final : public Packet
    {
    public:
        short getIndex() const override;

        int PlaceId = 0;
    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;

    };
    class MagicLeveled final : public Packet
    {
    public:
        short getIndex() const override;

        Spell Spell = static_cast<Spell>(0);
        unsigned char Level = 0;
        unsigned short Experience = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class Magic final : public Packet
    {
    public:
        virtual ~Magic()
        {
            delete Target;
        }

        short getIndex() const override;

        Spell Spell = static_cast<Spell>(0);
        unsigned int TargetID = 0;
        Point *Target;
        bool Cast = false;
        unsigned char Level = 0;

        std::vector<unsigned int> SecondaryTargetIDs;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class MagicDelay final : public Packet
    {
    public:
        short getIndex() const override;

        Spell Spell = static_cast<Spell>(0);
        long long Delay = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class MagicCast final : public Packet
    {
    public:
        short getIndex() const override;

        Spell Spell = static_cast<Spell>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ObjectMagic final : public Packet
    {
    public:
        virtual ~ObjectMagic()
        {
            delete Location;
            delete Target;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

        Spell Spell = static_cast<Spell>(0);
        unsigned int TargetID = 0;
        Point *Target;
        bool Cast = false;
        unsigned char Level = 0;
        bool SelfBroadcast = false;
        std::vector<unsigned int> SecondaryTargetIDs;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };



    class ObjectEffect final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        SpellEffect Effect = static_cast<SpellEffect>(0);
        unsigned int EffectType = 0;
        unsigned int DelayTime = 0;
        unsigned int Time = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ObjectProjectile final : public Packet
    {
    public:
        short getIndex() const override;

        Spell Spell = static_cast<Spell>(0);
        unsigned int Source = 0;
        unsigned int Destination = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class RangeAttack final : public Packet //ArcherTest
    {
    public:
        virtual ~RangeAttack()
        {
            delete Target;
        }

        short getIndex() const override;

        unsigned int TargetID = 0;
        Point *Target;
        Spell Spell = static_cast<Spell>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class Pushed final : public Packet
    {
    public:
        virtual ~Pushed()
        {
            delete Location;
        }

        short getIndex() const override;

        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectPushed final : public Packet
    {
    public:
        virtual ~ObjectPushed()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectName final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        std::string Name = std::string::Empty;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class UserStorage final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<UserItem*> Storage;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class SwitchGroup final : public Packet
    {
    public:
        short getIndex() const override;

        bool AllowGroup = false;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class DeleteGroup final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class DeleteMember final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name = std::string::Empty;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class GroupInvite final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name = std::string::Empty;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class AddMember final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name = std::string::Empty;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class Revived final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectRevived final : public Packet
    {
    public:
        short getIndex() const override;
        unsigned int ObjectID = 0;
        bool Effect = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class SpellToggle final : public Packet
    {
    public:
        short getIndex() const override;
        Spell Spell = static_cast<Spell>(0);
        bool CanUse = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectHealth final : public Packet
    {
    public:
        short getIndex() const override;
        unsigned int ObjectID = 0;
        unsigned char Percent = 0, Expire = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class MapEffect final : public Packet
    {
    public:
        virtual ~MapEffect()
        {
            delete Location;
        }

        short getIndex() const override;

        Point *Location;
        SpellEffect Effect = static_cast<SpellEffect>(0);
        unsigned char Value = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectRangeAttack final : public Packet
    {
    public:
        virtual ~ObjectRangeAttack()
        {
            delete Location;
            delete Target;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        unsigned int TargetID = 0;
        Point *Target;
        unsigned char Type = 0;
        Spell Spell = static_cast<Spell>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class AddBuff final : public Packet
    {
    public:
        virtual ~AddBuff()
        {
            delete Buff;
        }

        short getIndex() const override;

        ClientBuff *Buff;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class RemoveBuff final : public Packet
    {
    public:
        short getIndex() const override;

        BuffType Type = static_cast<BuffType>(0);
        unsigned int ObjectID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectHidden final : public Packet
    {
    public:
        short getIndex() const override;
        unsigned int ObjectID = 0;
        bool Hidden = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class RefreshItem final : public Packet
    {
    public:
        virtual ~RefreshItem()
        {
            delete Item;
        }

        short getIndex() const override;
        UserItem *Item;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectSpell final : public Packet
    {
    public:
        virtual ~ObjectSpell()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        Spell Spell = static_cast<Spell>(0);
        MirDirection Direction = static_cast<MirDirection>(0);
        bool Param = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class UserDash final : public Packet
    {
    public:
        virtual ~UserDash()
        {
            delete Location;
        }

        short getIndex() const override;

        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectDash final : public Packet
    {
    public:
        virtual ~ObjectDash()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class UserDashFail final : public Packet
    {
    public:
        virtual ~UserDashFail()
        {
            delete Location;
        }

        short getIndex() const override;

        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectDashFail final : public Packet
    {
    public:
        virtual ~ObjectDashFail()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class RemoveDelayedExplosion final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class NPCConsign final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCMarket final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<ClientAuction*> Listings = std::vector<ClientAuction*>();
        int Pages = 0;
        bool UserMode = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCMarketPage final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<ClientAuction*> Listings = std::vector<ClientAuction*>();

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ConsignItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class MarketFail final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char Reason = 0;

        /*
         * 0: Dead.
         * 1: Not talking to TrustMerchant.
         * 2: Already Sold.
         * 3: Expired.
         * 4: Not enough Gold.
         * 5: Too heavy or not enough bag space.
         * 6: You cannot buy your own items.
         * 7: Trust Merchant is too far.
         * 8: Too much Gold.
         */

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class MarketSuccess final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Message = std::string::Empty;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectSitDown final : public Packet
    {
    public:
        virtual ~ObjectSitDown()
        {
            delete Location;
        }

        short getIndex() const override;
        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        bool Sitting = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class InTrapRock final : public Packet
    {
    public:
        short getIndex() const override;
        bool Trapped = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class BaseStatsInfo final : public Packet
    {
    public:
        virtual ~BaseStatsInfo()
        {
            delete Stats;
        }

        short getIndex() const override;

        BaseStats *Stats;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class UserName final : public Packet
    {
    public:
        short getIndex() const override;
        unsigned int Id = 0;
        std::string Name;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class ChatItemStats final : public Packet
    {
    public:
        virtual ~ChatItemStats()
        {
            delete Stats;
        }

        short getIndex() const override;
        unsigned long long ChatItemId = 0;
        UserItem *Stats;
    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class GuildNoticeChange final : public Packet
    {
    public:
        short getIndex() const override;
        int update = 0;
        std::vector<std::string> notice = std::vector<std::string>();
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class GuildMemberChange final : public Packet
    {
    public:
        short getIndex() const override;
        std::string Name = std::string::Empty;
        unsigned char Status = 0;
        unsigned char RankIndex = 0;
        std::vector<GuildRank*> Ranks = std::vector<GuildRank*>();
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class GuildStatus final : public Packet
    {
    public:
        short getIndex() const override;
        std::string GuildName = std::string::Empty;
        std::string GuildRankName = std::string::Empty;
        unsigned char Level = 0;
        long long Experience = 0;
        long long MaxExperience = 0;
        unsigned int Gold = 0;
        unsigned char SparePoints = 0;
        int MemberCount = 0;
        int MaxMembers = 0;
        bool Voting = false;
        unsigned char ItemCount = 0;
        unsigned char BuffCount = 0;
        GuildRankOptions MyOptions = static_cast<GuildRankOptions>(0);
        int MyRankId = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class GuildInvite final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name = std::string::Empty;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class GuildExpGain final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int Amount = 0;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class GuildNameRequest final : public Packet
    {
    public:
        short getIndex() const override;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class GuildStorageGoldChange final : public Packet
    {
    public:
        short getIndex() const override;
        unsigned int Amount = 0;
        unsigned char Type = 0;
        std::string Name = std::string::Empty;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class GuildStorageItemChange final : public Packet
    {
    public:
        virtual ~GuildStorageItemChange()
        {
            delete Item;
        }

        short getIndex() const override;
        int User = 0;
        unsigned char Type = 0;
        int To = 0;
        int From = 0;
        GuildStorageItem *Item = nullptr;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class GuildStorageList final : public Packet
    {
    public:
        short getIndex() const override;
        std::vector<GuildStorageItem*> Items;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;

    };
    class GuildRequestWar final : public Packet
    {
    public:
        short getIndex() const override;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class DefaultNPC final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class NPCUpdate final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int NPCID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };


    class NPCImageUpdate final : public Packet
    {
    public:
        virtual ~NPCImageUpdate()
        {
            delete Colour;
        }

        short getIndex() const override;

        long long ObjectID = 0;
        unsigned short Image = 0;
        Color *Colour;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class MountUpdate final : public Packet
    {
    public:
        short getIndex() const override;

        long long ObjectID = 0;
        short MountType = 0;
        bool RidingMount = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class TransformUpdate final : public Packet
    {
    public:
        short getIndex() const override;

        long long ObjectID = 0;
        short TransformType = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class EquipSlotItem final : public Packet
    {
    public:
        short getIndex() const override;

        MirGridType Grid = static_cast<MirGridType>(0);
        unsigned long long UniqueID = 0;
        int To = 0;
        bool Success = false;
        MirGridType GridTo = static_cast<MirGridType>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class FishingUpdate final : public Packet
    {
    public:
        virtual ~FishingUpdate()
        {
            delete FishingPoint;
        }

        short getIndex() const override;

        long long ObjectID = 0;
        bool Fishing = false;
        int ProgressPercent = 0;
        int ChancePercent = 0;
        Point *FishingPoint;
        bool FoundFish = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    //public sealed class UpdateQuests : Packet
    //{
    //    public override short Index
    //    {
    //        get { return (short)ServerPacketIds.UpdateQuests; }
    //    }

    //    public List<ClientQuestProgress> CurrentQuests = new List<ClientQuestProgress>();
    //    public List<int> CompletedQuests = new List<int>();

    //    protected override void ReadPacket(BinaryReader reader)
    //    {
    //        int count = reader.ReadInt32();
    //        for (var i = 0; i < count; i++)
    //            CurrentQuests.Add(new ClientQuestProgress(reader));

    //        count = reader.ReadInt32();
    //        for (var i = 0; i < count; i++)
    //            CompletedQuests.Add(reader.ReadInt32());
    //    }
    //    protected override void WritePacket(BinaryWriter writer)
    //    {
    //        writer.Write(CurrentQuests.Count);
    //        foreach (var q in CurrentQuests)
    //            q.Save(writer);

    //        writer.Write(CompletedQuests.Count);
    //        foreach (int q in CompletedQuests)
    //            writer.Write(q);
    //    }
    //}


    class ChangeQuest final : public Packet
    {
    public:
        virtual ~ChangeQuest()
        {
            delete Quest;
        }

        short getIndex() const override;

        ClientQuestProgress *Quest = new ClientQuestProgress();
        QuestState QuestState = static_cast<QuestState>(0);
        bool TrackQuest = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class CompleteQuest final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<int> CompletedQuests = std::vector<int>();

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ShareQuest final : public Packet
    {
    public:
        short getIndex() const override;

        int QuestIndex = 0;
        std::string SharerName;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };


    class NewQuestInfo final : public Packet
    {
    public:
        virtual ~NewQuestInfo()
        {
            delete Info;
        }

        short getIndex() const override;

        ClientQuestInfo *Info;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class GainedQuestItem final : public Packet
    {
    public:
        virtual ~GainedQuestItem()
        {
            delete Item;
        }

        short getIndex() const override;

        UserItem *Item;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class DeleteQuestItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        unsigned short Count = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class GameShopInfo final : public Packet
    {
    public:
        virtual ~GameShopInfo()
        {
            delete Item;
        }

        short getIndex() const override;

        GameShopItem *Item;
        int StockLevel = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class GameShopStock final : public Packet
    {
    public:
        short getIndex() const override;

        int GIndex = 0;
        int StockLevel = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class CancelReincarnation final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class RequestReincarnation final : public Packet
    {
    public:
        short getIndex() const override;


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;

    };

    class UserBackStep final : public Packet
    {
    public:
        virtual ~UserBackStep()
        {
            delete Location;
        }

        short getIndex() const override;

        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ObjectBackStep final : public Packet
    {
    public:
        virtual ~ObjectBackStep()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        int Distance = 0;


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class UserDashAttack final : public Packet
    {
    public:
        virtual ~UserDashAttack()
        {
            delete Location;
        }

        short getIndex() const override;

        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ObjectDashAttack final : public Packet
    {
    public:
        virtual ~ObjectDashAttack()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);
        int Distance = 0;


    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class UserAttackMove final : public Packet //warrior skill - SlashingBurst move packet
    {
    public:
        virtual ~UserAttackMove()
        {
            delete Location;
        }

        short getIndex() const override;


        Point *Location;
        MirDirection Direction = static_cast<MirDirection>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;


        void WritePacket(BinaryWriter *writer) override;
    };

    class CombineItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long IDFrom = 0, IDTo = 0;
        bool Success = false;
        bool Destroy = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ItemUpgraded final : public Packet
    {
    public:
        virtual ~ItemUpgraded()
        {
            delete Item;
        }

        short getIndex() const override;

        UserItem *Item;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class SetConcentration final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        bool Enabled = false;
        bool Interrupted = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class SetElemental final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        bool Enabled = false;
        bool Casted = false;
        unsigned int Value = 0;
        unsigned int ElementType = 0;
        unsigned int ExpLast = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ObjectDeco final : public Packet
    {
    public:
        virtual ~ObjectDeco()
        {
            delete Location;
        }

        short getIndex() const override;

        unsigned int ObjectID = 0;
        Point *Location;
        int Image = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class ObjectSneaking final : public Packet
    {
    public:
        short getIndex() const override;
        unsigned int ObjectID = 0;
        bool SneakingActive = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ObjectLevelEffects final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        LevelEffects LevelEffects = static_cast<LevelEffects>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class SetBindingShot final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;
        bool Enabled = false;
        long long Value = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class SendOutputMessage final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Message;
        OutputMessageType Type = static_cast<OutputMessageType>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCAwakening final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCDisassemble final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCDowngrade final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class NPCReset final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class AwakeningNeedMaterials final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<ItemInfo*> Materials;
        std::vector<unsigned char> MaterialsCount;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class AwakeningLockedItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        bool Locked = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class Awakening final : public Packet
    {
    public:
        short getIndex() const override;

        int result = 0;
        long long removeID = -1;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ReceiveMail final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<ClientMail*> Mail = std::vector<ClientMail*>();

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class MailLockedItem final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned long long UniqueID = 0;
        bool Locked = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class MailSent final : public Packet
    {
    public:
        signed char Result = 0;

        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class MailSendRequest final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ParcelCollected final : public Packet
    {
    public:
        signed char Result = 0;

        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class MailCost final : public Packet
    {
    public:
        unsigned int Cost = 0;

        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ResizeInventory final : public Packet
    {
    public:
        short getIndex() const override;

        int Size = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ResizeStorage final : public Packet
    {
    public:
        short getIndex() const override;

        int Size = 0;
        bool HasExpandedStorage = false;
        DateTime ExpiryTime;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class NewIntelligentCreature final : public Packet //IntelligentCreature
    {
    public:
        virtual ~NewIntelligentCreature()
        {
            delete Creature;
        }

        short getIndex() const override;

        ClientIntelligentCreature *Creature;
    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class UpdateIntelligentCreatureList final : public Packet //IntelligentCreature
    {
    public:
        short getIndex() const override;

        std::vector<ClientIntelligentCreature*> CreatureList = std::vector<ClientIntelligentCreature*>();
        bool CreatureSummoned = false;
        IntelligentCreatureType SummonedCreatureType = IntelligentCreatureType::None;
        int PearlCount = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class IntelligentCreatureEnableRename final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class IntelligentCreaturePickup final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int ObjectID = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class NPCPearlGoods final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<UserItem*> List = std::vector<UserItem*>();
        float Rate = 0;
        PanelType Type = static_cast<PanelType>(0);

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class FriendUpdate final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<ClientFriend*> Friends = std::vector<ClientFriend*>();

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class GuildBuffList final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char Remove = 0;
        std::vector<GuildBuff*> ActiveBuffs = std::vector<GuildBuff*>();
        std::vector<GuildBuffInfo*> GuildBuffs = std::vector<GuildBuffInfo*>();

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };
    class LoverUpdate final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name;
        DateTime Date;
        std::string MapName;
        short MarriedDays = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class MentorUpdate final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name;
        unsigned short Level = 0;
        bool Online = false;
        long long MenteeEXP = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class NPCRequestInput final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int NPCID = 0;
        std::string PageName;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class Rankings final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned char RankType = 0;
        int MyRank = 0;
        std::vector<RankCharacterInfo*> Listings = std::vector<RankCharacterInfo*>();

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class Opendoor final : public Packet
    {
    public:
        short getIndex() const override;

        bool Close = false;
        unsigned char DoorIndex = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class GetRentedItems final : public Packet
    {
    public:
        short getIndex() const override;

        std::vector<ItemRentalInformation*> RentedItems = std::vector<ItemRentalInformation*>();

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ItemRentalRequest final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Name;
        bool Renting = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ItemRentalFee final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int Amount = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ItemRentalPeriod final : public Packet
    {
    public:
        short getIndex() const override;

        unsigned int Days = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class DepositRentalItem final : public Packet
    {
    public:
        short getIndex() const override;

        int From = 0, To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class RetrieveRentalItem final : public Packet
    {
    public:
        short getIndex() const override;

        int From = 0, To = 0;
        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class UpdateRentalItem final : public Packet
    {
    public:
        virtual ~UpdateRentalItem()
        {
            delete LoanItem;
        }

        short getIndex() const override;

        bool HasData = false;
        UserItem *LoanItem;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class CancelItemRental final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ItemRentalLock final : public Packet
    {
    public:
        short getIndex() const override;

        bool Success = false;
        bool GoldLocked = false;
        bool ItemLocked = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ItemRentalPartnerLock final : public Packet
    {
    public:
        short getIndex() const override;

        bool GoldLocked = false;
        bool ItemLocked = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class CanConfirmItemRental final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };

    class ConfirmItemRental final : public Packet
    {
    public:
        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };


    class NewRecipeInfo final : public Packet
    {
    public:
        virtual ~NewRecipeInfo()
        {
            delete Info;
        }

        short getIndex() const override;

        ClientRecipeInfo *Info;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class CraftItem final : public Packet
    {
    public:
        short getIndex() const override;

        bool Success = false;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };


    class OpenBrowser final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Url;

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
    class PlaySound final : public Packet
    {
    public:
        int Sound = 0;

        short getIndex() const override;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class SetTimer final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Key;
        unsigned char Type = 0;
        int Seconds = 0;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class ExpireTimer final : public Packet
    {
    public:
        short getIndex() const override;

        std::string Key;

    protected:
        void ReadPacket(BinaryReader *reader) override;
        void WritePacket(BinaryWriter *writer) override;
    };

    class UpdateNotice final : public Packet
    {
    public:
        virtual ~UpdateNotice()
        {
            delete Notice;
        }

        short getIndex() const override;

        Notice *Notice = new Notice();

    protected:
        void ReadPacket(BinaryReader *reader) override;

        void WritePacket(BinaryWriter *writer) override;
    };
}
